function  coef  = ols(y,X)

% Original model: y = X*beta + u

% OLS estimates; 
            try
                beta_OLS = (X'*X)^(-1)*X'*y;
                
            catch
                          
                beta_OLS = zeros(size(X,2),1);
            end

coef = beta_OLS;